#include <QApplication>
#include "MainSceneWidget.h"
#include <QKinectLib/KinectSensor.h>


int main(int argc, char *argv[])
{
	try {
		QApplication a(argc, argv);
		//ComputeShaderTestWidget w (NULL);
		MainSceneWidget w;
		int idx = 1;
		Sensor* tempSensor = NULL;
		if (idx != 0)
			tempSensor = new KinectSensor (QString ("Kinect"),
					NUI_IMAGE_TYPE_DEPTH, NUI_IMAGE_RESOLUTION_640x480,
					NUI_IMAGE_TYPE_COLOR, NUI_IMAGE_RESOLUTION_640x480);
		Sensor* p_sensor = new KinectSensor (idx, QString ("Kinect"),
// 				QString ("../Data/%1.krec").arg (i),
				NUI_IMAGE_TYPE_DEPTH, NUI_IMAGE_RESOLUTION_640x480,
				NUI_IMAGE_TYPE_COLOR, NUI_IMAGE_RESOLUTION_640x480,
				QString ("../Data/Intrinsic/try%1.int").arg (idx));
		w.show ();
		w.initialize (p_sensor, QString("../Data/%1.ext").arg (idx));
		p_sensor->start ();
		delete tempSensor;
		return a.exec();
	} catch (std::exception e) {
		OutputDebugStringA ("Error: ");
		OutputDebugStringA (e.what ());
		OutputDebugStringA ("\n");
	} catch (QKinectException e) {
		OutputDebugStringA ("Error: ");
		OutputDebugStringA (e.getMessage ().toLocal8Bit ().data ());
		OutputDebugStringA ("\n");
	} catch (...) {
		OutputDebugStringA ("Error: Unknown Exception caught\n");
	}

}